<?php
	class SiteController extends Controller{
		public $layout='column1';

		public function actions(){
			return array(
				'captcha'=>array(
					'class'=>'CCaptchaAction',
					'backColor'=>0xFFFFFF,
				),

				'page'=>array('class'=>'CViewAction',),
			);
		}
		public function actionIndex(){
			$this->render('index');
		}

		public function actionLogin(){
			$model=new LoginForm;
			if(isset($_POST['ajax']) && $_POST['ajax']==='login-form'){
				echo CActiveForm::validate($model);
				Yii::app()->end();
			}
			if(isset($_POST['LoginForm'])){
				$model->attributes=$_POST['LoginForm'];
				if($model->validate() && $model->login()){
					$this->redirect(Yii::app()->user->returnUrl);
				}
			}
			$this->render('login', array('model'=>$model));
		}

		public function actionLogout(){
			Yii::app()->user->logout();
			$this->redirect(Yii::app()->homeUrl);
		}
	}
